package com.parking.common.core.paracheck.checker;

import com.parking.common.core.paracheck.GOODOKBAD;
import com.parking.common.core.paracheck.JustTwoDecimal;
import org.springframework.boot.web.servlet.ServletContextInitializer;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * 自定义注释 字符串只能是Good Ok Bad
 * */
public class GOODOKBADChecker implements ConstraintValidator<GOODOKBAD, String> {
    /**
     * 自定义注释校验方法 字符串只能是Good Ok Bad
     * */
    @Override
    public boolean isValid(String score, ConstraintValidatorContext constraintValidatorContext) {
        if(score==null||score.equals("")) return true;
        if(score.equals("Good")) return true;
        if(score.equals("Bad")) return true;
        if(score.equals("OK")) return true;
        return false;
    }
}
